// src/renderer/utils/webSocket.ts
import { onMounted, ref, onBeforeUnmount, watch } from "vue";
import { useWebSocket } from "@vueuse/core";
const aa = useWebSocket(
    "ws://127.0.0.1:8092/websocket/1",
    {
        autoReconnect: true,
        heartbeat: {
            message: JSON.stringify({ serviceType: "ping" }),
            interval: 30000,
            pongTimeout: 30000,
        },
    }
);

// 监听 data 的变化并打印
watch(data, (newData) => {
    console.log("WebSocket data:", newData);
    const message = JSON.parse(newData); // 解析消息
    //         // 处理消息逻辑
    store.handleSocketMessage(message); // 调用 action 将消息放入 store
});
export default {
    aa
};